import Toast from "./Toast";

const plugin = {}

plugin.install = (Vue)=>{
  const ToastConstructor = Vue.extend(Toast)

  Vue.prototype.$toast = (options={})=>{
    const toast = new ToastConstructor()

    toast.$mount(document.createElement('div'))

    document.body.appendChild(toast.$el)

    toast.message = options.message
    toast.isShow = true

    setTimeout(()=>{
      toast.isShow = false
    },options.duration)
  }
}






export default plugin